plugin_CopyToLaunch:
	LastCtrlC := 0
return

; =================================================
; Double Ctrl+C to launch with clipboard
; -------------------------------------------------
$^c::
	if (A_TickCount - LastCtrlC < DoublePressTime) {
		LastCtrlC := 0
		CopyAndLaunch() ; defined in plugin_DefaultKeys.ahk
	}
	else {
		clipboard =
		LastCtrlC := A_TickCount
		Send, ^c
	}
return

CopyAndLaunch()
{
	; wait for something is copied to clipboard
	if (!clipboard) {
		ClipWait, 0.1
		if (!clipboard) {
			Send, {Home}+{End}^c ; try copy current line
			ClipWait, 0.5
		}
	}
	
	; drop return chars
	tmp := clipboard
	StringReplace, tmp, tmp, `r`n, %A_Space%, All

	; launch with initial text
	ShowMyLaunch(tmp)
}
